<template>
  <div class="collection">
    <div class="collection-kuan test-1">
      <div class="collection-one">
        <div class="one-text">我的收藏</div>
        <!-- <div class="one-button">
          <div class="button">全部播放&nbsp;&nbsp;<van-icon name="plus" /></div>
        </div> -->
      </div>
      <van-tabs v-if="ifEavr">
        <van-tab title="歌手">
          <div v-if="collectionGeshou.length !== 0" class="collection-two">
            <div class="two-kuan">
              <div
                class="neiron-kuan"
                v-for="(item, index) in collectionGeshou"
                :key="index"
                @click="SingerDetailsPage(item.id)"
              >
                <div class="neiron-img">
                  <img :src="item.img1v1Url" alt="" />
                </div>
                <div class="neiron-text">{{ item.name }}</div>
              </div>
              <div class="clear"></div>
            </div>
          </div>
          <div class="akakak" v-if="collectionGeshou.length == 0">没有数据</div>
        </van-tab>
        <van-tab title="专辑">
          <div v-if="collectionZhuanji.length !== 0" class="collection-two">
            <div class="two-kuan">
              <div
                class="neiron-kuan"
                v-for="(item, index) in collectionZhuanji"
                :key="index"
                @click="AlbumDetails(item.id)"
              >
                <div class="neiron-img">
                  <img :src="item.blurPicUrl" alt="" />
                </div>
                <div class="neiron-text">{{ item.name }}</div>
              </div>
              <div class="clear"></div>
            </div>
          </div>
          <div class="akakak" v-if="collectionZhuanji.length == 0">
            没有数据
          </div>
        </van-tab>
        <van-tab title="歌单">
          <div v-if="collectionGedan.length !== 0" class="collection-two">
            <div class="two-kuan">
              <div
                class="neiron-kuan"
                v-for="(item, index) in collectionGedan"
                :key="index"
                @click="Details(item.id)"
              >
                <div class="neiron-img">
                  <img :src="item.coverImgUrl" alt="" />
                </div>
                <div class="neiron-text">{{ item.name }}</div>
              </div>
              <div class="clear"></div>
            </div>
          </div>
          <div class="akakak" v-if="collectionGedan.length == 0">没有数据</div>
        </van-tab>
      </van-tabs>
      <div v-if="!ifEavr" class="collection-three-aaaa">请登录</div>
    </div>
  </div>
</template>

<script>
export default {
  name: "Collection",
  data() {
    return {
      value: "",
      activeIndex: 1,
      ifEavr: false,
      collectionGedan: [],
      collectionZhuanji: [],
      collectionGeshou: [],
    };
  },
  created() {
    this.gai();
  },
  methods: {
    gai() {
      setInterval(() => {
        this.ifEavr = this.$store.state.ifEavr;
        this.$store.state.activeIndex = this.activeIndex;
      }, 100);
      this.collectionGedan = this.$store.state.collectionGedan;
      this.collectionZhuanji = this.$store.state.collectionZhuanji;
      this.collectionGeshou = this.$store.state.collectionGeshou;
      // console.log("this.collectionGedan==>", this.collectionGedan);
      // console.log("this.collectionGeshou==>", this.collectionGeshou);
      // console.log("this.collectionZhuanji==>", this.collectionZhuanji);
    },
    AlbumDetails(id) {
      // console.log('id==>',id);
      this.$router.push({ name: "AlbumDetails", params: { id } });
    },
    SingerDetailsPage(id) {
      // console.log('id==>',id);
      this.$router.push({ name: "SingerDetailsPage", params: { id } });
    },
    Details(id) {
      // console.log('id==>',id);
      this.$router.push({ name: "Details", params: { id } });
    },
  },
};
</script>

<style lang="less" scoped>
.collection-three-aaaa {
  width: 712.5px;
  height: 500px;
  font-size: 18px;
  color: #b3b3b3;
  line-height: 500px;
  text-align: center;
}
.test-1::-webkit-scrollbar {
  /*滚动条整体样式*/
  width: 5px; /*高宽分别对应横竖滚动条的尺寸*/
  height: 1px;
}
.test-1::-webkit-scrollbar-thumb {
  /*滚动条里面小方块*/
  // border-radius: 10px;
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  background: #b3b3b3;
}
.test-1::-webkit-scrollbar-track {
  /*滚动条里面轨道*/
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  // border-radius: 10px;
  background: #ededed;
}
::v-deep .van-tabs--line .van-tabs__wrap {
  width: 100%;
  height: 30px;
}
.clear {
  clear: both;
  width: 100%;
  height: 1px;
}
.collection-kuan {
  width: 712.5px;
  height: 500px;
  background-color: rgb(255, 255, 255);
  overflow-y: scroll;
  .collection-one {
    width: 100%;
    height: 60px;
    font-size: 14px;
    .one-text {
      float: left;
      width: calc(50% - 20px);
      height: 60px;
      line-height: 60px;
      padding-left: 20px;
    }
    .one-button {
      float: right;
      width: calc(50% - 20px);
      height: 60px;
      padding-right: 20px;
      position: relative;
      .button {
        line-height: 32px;
        text-align: center;
        width: 120px;
        height: 32px;
        color: white;
        border-radius: 16px;
        position: absolute;
        right: 20px;
        top: 14px;
        background-color: rgb(252, 63, 63);
      }
    }
  }
  .collection-two {
    width: calc(100% - 40px);
    height: 100%;
    padding: 0 20px;
    .two-kuan {
      width: 100%;
      height: 100%;
      .clear {
        clear: both;
        width: 100%;
        height: 1px;
      }
      .neiron-kuan {
        float: left;
        width: calc(133.5px - 20px);
        height: calc(170px - 20px);
        padding: 10px;
        .neiron-img {
          width: 113.5px;
          height: 113.5px;
          img {
            width: 100%;
            height: 100%;
            border-radius: 5px;
          }
        }
        .neiron-text {
          width: 113.5px;
          height: 31.5px;
          padding-top: 5px;
        }
      }
    }
  }
}
.akakak {
  width: 100%;
  height: 200px;
  line-height: 200px;
  text-align: center;
  font-size: 16px;
  color: #b3b3b3;
}
</style>